package com.fxl.majiang.message.output;

import com.alibaba.fastjson.JSON;
import com.fxl.majiang.enums.OutputMsgTypeEnum;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * @author fengxinglei
 * @date 2022/8/2 9:01
 * @description 输出msg
 */
@Data
@NoArgsConstructor
public class OutputMessage implements Serializable {
    private static final long serialVersionUID = -6762860054375340283L;

    /**
     * @see OutputMsgTypeEnum
     */
    private int code;

    private String data;

    public OutputMessage(int code, String data) {
        this.code = code;
        this.data = data;
    }

    public OutputMessage(int code, OutputMessageData data) {
        this.code = code;
        this.data = JSON.toJSONString(data);
    }
}
